package com.way.v1;

/**
 * @author 魏彪
 */
public class Test {
    public static void main(String[] args) {
        DraftsBox draftsBox = new DraftsBox();

        Editor editor = new Editor("我是这样写一本书的", "content", "img");

        ArticleMemento articleMemento = editor.saveToMemento();
        draftsBox.addMemento(articleMemento);

        System.out.println("标题：" + editor.getTitle()
                + "内容：" + editor.getContent()
                + "图片：" + editor.getImg());

        System.out.println("完整信息" + editor);

        System.out.println("=========首次修改文章=========");
        editor.setTitle("[Tom原创]");
        System.out.println("=========首次修改文章完成=========");

        System.out.println("完整信息" + editor);

        articleMemento = editor.saveToMemento();
        draftsBox.addMemento(articleMemento);

        System.out.println("=========首次撤销文章=========");
        articleMemento = draftsBox.getMemento();

        editor.undoFromMemento(articleMemento);
        System.out.println("完整信息" + editor);
    }
}
